dataframe 為資料框
可以看做excel一個資料表
import pandas as pd # 引用套件並縮寫為 pd
groups = ["Airport", "Sports", "reading", "Fishing", "Dancing", "cooking"]
num = [46, 8, 12, 12, 6, 58]
dict1 = {"groups": groups,
"num": num
}
select_df = pd.DataFrame(dict1) #dict to dataframe
print(select_df) # 看看資料框的外觀
import pandas as pd # 引用套件並縮寫為 pd...
groups num
0 Airport 5
1 Sports 8
2 reading 12
3 Fishing 11
4 Dancing 6
5 playing 156